package pattern.prototype;

import java.io.IOException;

public class DoMain {
	public static void main(String[] args) throws CloneNotSupportedException, ClassNotFoundException, IOException {
		Prototype p = new Prototype();
		Prototype p1 = (Prototype)p.clone();
		Prototype p2 = (Prototype)p.deepClone();
		
		/*不论是深复制还是浅复制，此处都不会为true*/
		System.out.println(p==p1);
		System.out.println(p==p2);
		System.out.println(p.equals(p1));
		System.out.println(p.equals(p2));
		
		System.out.println(p.getS()==p1.getS());//浅复制拿的其实是一个东西
		System.out.println(p.getS()==p2.getS());//深复制则不是
		System.out.println(p.getS().equals(p1.getS()));//字符串比较  没什么好说的
		System.out.println(p.getS().equals(p2.getS()));//字符串比较  没什么好说的
		
		System.out.println(p.getI()==p1.getI());//浅复制拿的其实是一个东西
		System.out.println(p.getI()==p2.getI());//深复制则不是
		System.out.println(p.getI().equals(p1.getI()));//字符串比较  没什么好说的
		System.out.println(p.getI().equals(p2.getI()));//字符串比较  没什么好说的
		
	}
}
